package com.zhouxiaoge.physical.partitioning;

import com.zhouxiaoge.ClickSource;
import com.zhouxiaoge.Event;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author 周小哥  gqzmy@163.com 2022/8/9 16:25
 */

public class RebalanceTest {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        DataStreamSource<Event> source = env.addSource(new ClickSource());

        source.rebalance().print("rebalance").setParallelism(4);

        env.execute();

    }
}
